package com.hs.communication.common.feign;

import com.hs.common.core.constant.SecurityConstants;
import com.hs.common.core.constant.ServiceNameConstants;
import com.hs.common.core.domain.Result;
import com.hs.communication.common.entity.Charger;
import com.hs.communication.common.entity.ChargerData;
import com.hs.communication.common.entity.Inverter;
import com.hs.communication.common.entity.InverterData;
import com.hs.communication.common.entity.vo.DeviceVo;
import com.hs.communication.common.fallback.RemoteChargerFallbackFactory;
import com.hs.communication.common.fallback.RemoteInverterFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 远程调用 inverter 服务
 */
@FeignClient(contextId = "remoteInverterService", value = ServiceNameConstants.INVERTER_SERVICE, fallbackFactory = RemoteInverterFallbackFactory.class)
public interface RemoteInverterService {
    /**
     * 获取 逆变器 统计数据
     */
    @GetMapping(value = "/inverter/statistics")
    Result<DeviceVo> getStatistics(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 插入 逆变器 实时数据
     *
     * @param inverterData,source
     */
    @PostMapping(value = "/inverter/data")
    Result<Boolean> insert(@RequestBody InverterData inverterData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    //更改为在线离线状态和相应的时间
    @PutMapping(value = "/inverter/status")
    Result<Boolean> updateStatus(@RequestBody Inverter inverter, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
